package com.busines.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.busines.service.ITest;

@Transactional
@Service("testService")
public class TestImpl implements ITest {

	@Autowired
	ThreadPoolTaskExecutor taskExecutor;
	
	@Override
	public String test() {
		taskExecutor.execute(
				new Runnable() {
			
			@Override
			public void run() {
				
				for(int i=0;i<10;i++){
					System.out.println(Thread.currentThread().getName()+"---"+i);
					try {
						Thread.sleep(1000L);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
		});
		return "success";
	}

}
